/*
 * Copyright (C), 2002-2016, 苏宁易购电子商务有限公司
 * FileName: BiStoreRetGdsDaoServiceImpl.java
 * Author:   13075787
 * Date:     2016年6月18日 下午1:59:56
 * Description: //模块目的、功能描述      
 * History: //修改记录
 * <author>      <time>      <version>    <desc>
 * 修改人姓名             修改时间            版本号                  描述
 */
package com.suning.sawp.service.impl.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.intf.dao.BiStoreRetGdsDaoService;
import com.suning.sawp.po.bi.BiStoreCateRetGdsMonthBean;
import com.suning.sawp.po.bi.BiStoreRetGdsMonthBean;

/**
 * 门店退货<br>
 * 门店退货统计
 *
 * @author 13075787
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
@Service("biStoreRetGdsDaoService")
public class BiStoreRetGdsDaoServiceImpl implements BiStoreRetGdsDaoService {

    private static final Integer NUM_ZERO = 0;

    @Resource
    DalClient dalClient;

    /*
     * (non-Javadoc)
     * @see com.suning.sawp.intf.dao.BiStoreRetGdsDaoService#queryCurMonthRetGdsMonth()
     */
    @Override
    public BiStoreRetGdsMonthBean queryCurMonthRetGdsMonth(String storeCode, String month) {
        BiStoreRetGdsMonthBean result = null;
        if (StringUtils.isNotBlank(storeCode)) {
            Map<String, Object> param = new HashMap<String, Object>();
            param.put("storeCode", storeCode);
            param.put("month", month);
            result = dalClient.queryForObject("BI_STORE_RET_GDS_MONTH.SELECT_QUERY_CUR_MONTH_RETGDS_MONTH", param,
                    BiStoreRetGdsMonthBean.class);
        }
        return result;
    }

    /*
     * (non-Javadoc)
     * @see com.suning.sawp.intf.dao.BiStoreRetGdsDaoService#queryCurMonthCateRetGdsMonth(java.util.List)
     */
    @Override
    public List<BiStoreCateRetGdsMonthBean> queryCurMonthCateRetGdsMonth(String storeCode, List<String> cateCodes, String month) {
        List<BiStoreCateRetGdsMonthBean> result = null;
        if (StringUtils.isNotBlank(storeCode) && CollectionUtils.isNotEmpty(cateCodes)) {
            Map<String, Object> param = new HashMap<String, Object>();
            param.put("storeCode", storeCode);
            // 品类编码
            param.put("cateCodes", cateCodes);
            param.put("month", month);
            param.put("startIndex", NUM_ZERO);
            param.put("maxCount", cateCodes.size());
            result = dalClient.queryForList("BI_STORE_CATE_RET_GDS_MONTH.SELECT_QUERY_CUR_MONTH_CATERETGDS_MONTH",
                    param, BiStoreCateRetGdsMonthBean.class);
        }
        return result;
    }

}
